const signUpButton = document.getElementById("signUp");
const signInButton = document.getElementById("signIn");
const container = document.getElementById("container");
const toLogin = document.getElementById("toLogin");
const toRegister = document.getElementById("toRegister");
sessionStorage.clear();
signUpButton.addEventListener("click", () => {
  container.classList.add("right-panel-active");
});

signInButton.addEventListener("click", () => {
  container.classList.remove("right-panel-active");
});
toLogin.addEventListener("click",()=>{
  let account_str=document.getElementById("u_account").value;
  if(account_str===null||account_str===""){
    alert("请输入账号");
    location.reload();
  }
  let pwd_str=document.getElementById("u_pwd").value;
  if(pwd_str===null||pwd_str===""){
    alert("请输入密码");
    location.reload();
  }
  // let code_str=document.getElementById("u_code").value;
  // if(code_str===null||code_str===""){
  //   alert("请输入验证码");
  //   location.reload();
  // }
})
toRegister.addEventListener("click",(e)=>{
  let account_str=document.getElementById("r_account").value;
  if(account_str===null||account_str===""){
    alert("请输入账号");
    e.preventDefault();
    return;
  }
  let name_str=document.getElementById("r_name").value;
  if(name_str===null||name_str===""){
    alert("请输入用户名");
    e.preventDefault();
    return;
  }
  let pwd_str=document.getElementById("r_pwd").value;
  if(pwd_str===null||pwd_str===""){
    alert("请输入密码");
    e.preventDefault();
    return;
  }
  let rpwd_str=document.getElementById("r_rpwd").value;
  if(rpwd_str===null||rpwd_str===""){
    alert("请输入确认密码");
    e.preventDefault();
    return;
  }
  if(rpwd_str !== pwd_str){
    alert("两次输入密码不一致");
    e.preventDefault();
    return;
  }
})
// let code_img = document.getElementById("code_img");
// code_img.addEventListener("click",()=>{
//   code_img.src = "/captcha?date=" + new Date();
// })
